package whisper.service.aspect;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import whisper.common.exception.check.EmptyFileException;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by JT on 2017/11/2.
 */
@ControllerAdvice
public class ControllerExceptionAscept {


    @ExceptionHandler(value = EmptyFileException.class)
    @ResponseBody
    public Map emptyFileExceptionHandler(EmptyFileException exception) {
        Map map = new HashMap();
        map.put("code", exception.getCode());
        map.put("message", exception.getMessage());
        return map;
    }

}
